package com.yic.module.system.controller.admin.logger.vo.externallog;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

import static com.yic.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

/**
 * 第三方API调用日志 Base VO，提供给添加、修改、详细的子 VO 使用
 * 如果子 VO 存在差异的字段，请不要添加到这里，影响 Swagger 文档生成
 */
@Data
public class ExternalLogBaseVO {

    @Schema(description = "系统类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @NotNull(message = "系统类型不能为空")
    private Integer systemType;

    @Schema(description = "操作名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
    @NotNull(message = "操作名称不能为空")
    private String name;

    @Schema(description = "请求url", example = "https://www.iocoder.cn")
    private String url;

    @Schema(description = "请求参数")
    private String requset;

    @Schema(description = "响应参数")
    private String response;

    @Schema(description = "响应状态码")
    private String code;

    @Schema(description = "响应描述", example = "你猜")
    private String description;

    @Schema(description = "请求开始时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime startTime;

    @Schema(description = "请求结束时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime endTime;

    @Schema(description = "耗时")
    private Integer duration;

    @Schema(description = "执行状态", example = "1")
    private Integer status;

}
